package com.cloud.drore.eboss.supplier.mapper;

import com.cloud.drore.eboos.common.base.MyMapper;
import com.cloud.drore.eboos.common.entity.supplier.Ticket;
import com.cloud.drore.eboss.supplier.entity.CombinationProductRelation;
import com.cloud.drore.eboss.supplier.mapper.provider.CombinationProductRelationProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

/**
 * 浙江卓锐科技股份有限公司 版权所有  Copyright 2018<br>
 *
 * @Description: <br>
 * @Project: eboos <br>
 * @CreateDate: Created in 2018/1/18 16:40 <br>
 * @Author: <a href="575842778@qq.com">郑永涛</a>
 */
public interface CombinationProductRelationMapper extends MyMapper<CombinationProductRelation> {

    @Select("select consume_id from eboos_combination_product_relation where combination_product_id = ${combinationProductId} ")
    List<Long> selectConsumeIdByCombinationProductId(@Param("combinationProductId") Long combinationProductId);

    @Select("select product_id from eboos_combination_product_relation where combination_product_id = ${combinationProductId} ")
    List<Long> selectProductIdByCombinationProductId(@Param("combinationProductId") Long combinationProductId);

    @SelectProvider(type = CombinationProductRelationProvider.class, method = "selectTicketInfoByCombinationProductId")
    List<Ticket> selectTicketInfoByCombinationProductId(Long combinationProductId);

    @Select(" select combination_product_id from eboos_combination_product_relation where product_id = ${ticketId} group by combination_product_id ")
    List<Long> selectCombinationProductIdByTicketId(@Param("ticketId") Long ticketId);

}